<template>
	<view>
		<u-modal v-model="tipModal" :show-title="false" confirm-text="拨号" :show-cancel-button="true"
			@confirm="handleMakeCall">
			<view class="addJobTips">
				<view class="text1">
					开通业务
				</view>
				<view class="text2">
					请您联系您的专属客服
				</view>
				<view class="text3">
					<text v-if="customerInfo.mobile&&customerInfo.mobile!=''">{{customerInfo.mobile}}</text>
					<text
						v-if="customerInfo.mobile==''&&customerInfo.tel&&customerInfo.tel!=''">{{customerInfo.mobile}}</text>
				</view>
				<view class="text4">
					{{customerInfo.name}}
				</view>
			</view>
		</u-modal>
		<u-toast ref="uToast" />
	</view>
</template>

<script>
	import handlerHttpError from '@/utils/error'
	import api from '@/api'
	export default {
		data() {
			return {
				tipModal: false,
				customerInfo: {}
			}
		},
		methods: {
			// 拨打电话
			handleMakeCall() {
				uni.makePhoneCall({
					phoneNumber: this.customerInfo.mobile != '' ? this.customerInfo.mobile : this.customerInfo
						.tel != '' ? this.customerInfo.tel : '', //仅为示例
					complete: function(res) {}
				});
			},
			getCustomer() {
				let platform = uni.getSystemInfoSync().platform
				// console.log(platform)
				// if(platform == 'ios'){
				// 	this.$refs.uToast.show({
				// 		title: '功能开发中'
				// 	})
				// } else {
				this.getCustomerInfo()
				// }
			},
			getCustomerInfo() {
				var that = this
				uni.request({
					method: 'get',
					url: getApp().globalData.baseURL + api.customer_service,
					data: {},
					header: {
						'user-token': this.$store.state.userToken,
						'platform': this.$store.state.platform
					},
					success(res) {
						if (res.data.code == 200) {
							that.customerInfo = {
								...res.data.data.info
							}
							that.tipModal = true
						} else {
							handlerHttpError({
								code: res.data.code,
								message: res.data.message
							})
						}
					},
					fail(err) {
						console.log(err)
					}
				})
			}
		}
	}
</script>

<style>
</style>